xen/console: Rework HYPERCALL_console_io interface
authorJulien Grall <julien.grall@arm.com>
Mon, 5 Aug 2019 10:19:03 +0000 (11:19 +0100)
committerJulien Grall <julien.grall@arm.com>
Fri, 16 Aug 2019 21:44:28 +0000 (22:44 +0100)
commitea601ec9995b56fc23130360269844e188441b45
tree04d3c6f8494f02283b4e2de29a83068e0c5e5ee3
parentb5e6e1ee8da59fe93aa7e403bf1feaf76903e1d0
xen/console: Rework HYPERCALL_console_io interface

At the moment, HYPERCALL_console_io is using signed int to describe the
command (@cmd) and the size of the buffer (@count).
    * @cmd does not need to be signed this used as a set of named value.
    None of them are negative. If new one are introduced they can be
    positive.
    * @count is used to know the size of the buffer. It makes little
    sense to have a negative value here.

So both variables are now switched to use unsigned int.

Changing @count to unsigned type will result in a change of behavior for
the existing commands:
    - write: Any buffer bigger than 2GB will now be printed rather than
      been ignored (the command return 0).
    - read: The return value is a signed 32-bit value for 32-bit Xen.
      To keep compatibility between 32-bit and 64-bit ABI, it
      effectively means the return value is 32-bit (despite been long
      on 64-bit). Negative value are used for error and positive value
      for the number of characters read. To avoid clash between the two
      sets, the buffer is still limited to 2GB. The only difference is
      an error is returned rather than claiming there are no characters.

The behavior is only affecting unlikely use of the current interface, so
this is not a big concern regarding backward compatibility.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/drivers/char/console.c
xen/include/xen/hypercall.h